﻿using System.Windows.Forms;
namespace KillBill.Presentation.Common.WindowsForms.AutoValidableControls
{
    public class AVPanel : Panel, IAutoValidableControl
    {
        public bool IsValid
        {
            get
            {
                if (DesignMode)
                    return true;
                bool isValid = true;
                foreach (var control in Controls)
                {
                    if (control.GetType() == typeof(AVTextBox) || control.GetType() == typeof(AVPanel))
                    {
                        if (!((IAutoValidableControl)control).IsValid)
                        {
                            isValid = false;
                        }
                    }
                }
                return isValid;
            }
        }

        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // AVPanel
            // 
            this.Paint += new System.Windows.Forms.PaintEventHandler(this.AVPanel_Paint);
            this.ResumeLayout(false);

        }

        private void AVPanel_Paint(object sender, PaintEventArgs e)
        {

        }
    }
}
